
<script type="text/javascript">
 $(function(){
 	$("#selcate").change(function(){
		var cate = $(this).val();
		 var datas = {
            cate: cate
           
        };
        var url = "{:U('Content/selectcate')}";
		
		$.post(url,{cate: cate , ajax : 1} ,function handel(res){

		// 遍历object属性
		var str = '';
		for (var i in res) { 
			 for(var j=1; j<res[i]['level']; j++){
			 	str +=  '&nbsp;&nbsp;&nbsp;&nbsp;';
			 }
			 str += "<input type='checkbox' name='checkbox_cate[]' value= " + res[i]['id']+ " />"+res[i]['name']+"<br />";
								
		}
		$("#checates").html(str);
	  
		} );
		
      
	});
	
	$("#getcate").click(function(){
		var cate = $("#catid").val();
		 var datas = {
            cate: cate
           
        };
        var url = "{:U('Content/selectcate')}";
		
		$.post(url,{cate: cate , ajax : 1} ,function handel(res){

		// 遍历object属性
		var str = '';
		for (var i in res) { 
			 for(var j=1; j<res[i]['level']; j++){
			 	str +=  '&nbsp;&nbsp;&nbsp;&nbsp;';
			 }
			 str += "<input type='checkbox' name='checkbox_cate[]' value= " + res[i]['id']+ " />"+res[i]['name']+"<br />";
								
		}
		$("#checates").html(str);
	  
		} );
		
      
	});
	
 });
 
</script>
<div class="pageContent">
    <form method="post" id="Content_insert" action="{:U('Content/bindcate',array('proid'=>$proid))}" class="pageForm" onsubmit="return validateCallback(this, dialogAjaxDone)">
       <input type='hidden' name='todo' value='{$todo}' />
	   <input type='hidden' name='ids' value='{$ids}' />
	    <div class="pageFormContent" layoutH="52">
            <div class="tabs" currentIndex="0" eventType="click">

           
                    <div id="product_base">                
					    <!--
						 <dl class="nowrap">
                            <dt><label>选择分类：</label></dt>
                            <dd>
                            	<select id="selcate" name='maincate'>
                            	<option value='3'>手机</option>
								<option value='70'>平板</option>
								<option value='4'>配件</option>
								<option value='14'>饰品</option>
								<option value='186'>靓号</option>
								<option value='199'>老郭专场</option>
								<option value='201'>下架国产机库</option>
								<option value='202'>行货机</option>
                            	</select>
							</dd>
                        </dl>
                   
                        <dl class="nowrap">
                            <dt></dt>
                            <dd>
                            <div id='checates'>
                         	<volist name='catalist' id='cate'>
                         		
								<php>
                         			for($i=1; $i<$cate['level']; $i++){									
										echo '&nbsp;&nbsp;&nbsp;&nbsp;';
									}									
								</php>

                         		<input type='checkbox' name='checkbox_cate[]' value="{$cate['id']}" /> {$cate.name}
								<br />
                         	</volist>
							</div>	
							</dd>
                        </dl>
                   -->
				   
				      <dl class="nowrap">
                            <dt><label>选择分类：</label></dt>
                            <dd>
                         <input id="catid" name="cat.id"  value="{if $pinfo}{$pinfo.id}{else}{$info['parent_id']}{/if}"  type="hidden"/>
						<input class="required" name="cat.name" value="{if $pinfo}{$pinfo.name}{else}{$cats[$info['parent_id']]['name']}{/if}" type="text" postField="keywords" suggestFields="id,name" suggestUrl="{:U('Content/suggest',array('tn'=>'product_category_tag','fn'=>'id,name'))}" lookupGroup="cat"/><a class="btnLook" href="{:U('Cat/lookup',array('tn'=>'product_category_tag','fn'=>'id,name','where'=>myencode(array('status'=>1),1)))}" lookupGroup="cat">查找分类</a>
                        <span class="info">查找分类</span> <input id="getcate" type='button' value='添加' />
							</dd>
                        </dl>
                  
			                
                    </div>
                  
            
				
				
            </div>
        </div>
	<div class="formBar">
				<ul>
					<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
					<li>
						<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
					</li>
				</ul>
			</div>		
    </form>
</div>
